package com.mq.colony;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * 队列消费者
 * @author ytj
 * @date 2024/1/17
 */
@Component
@RabbitListener(
        bindings = @QueueBinding(
        value = @Queue(
                name = ColonyMessage.QUEUE+"-"+"group-02"
        ),
        exchange = @Exchange(
                name = ColonyMessage.EXCHANGE,
                type = ExchangeTypes.TOPIC,
                declare = "false"
        ),
        key = "#"
    )
)
public class ColonyConsumer2 {

    @RabbitHandler
    public void message(ColonyMessage colonyMessage){
        System.out.println("group-02获取消息:"+colonyMessage.getId());
    }
}
